<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="root"></div>
    <!-- <label for=""></label> -->
    <script src="./react.development.js"></script>
    <script src="./react-dom.development.js"></script>
    <script src="./babel.min.js"></script>
    <script type="text/babel">
      let arr = ['a', 'b', 'c']

      // const lis = arr.map(item=>{
      //   return <li>{item}</li>
      // })

      // let lis = [<li>a</li>, <li>b</li>, <li>c</li>]

      // const ul = <ul>{lis}</ul>

      // const ul = (
      //   <ul>
      //     {arr.map((item) => {
      //       return <li>{item}</li>
      //     })}
      //   </ul>
      // )
      const ul = (
        <ul>
          {arr.map((item, index) => (
            // 列表渲染时,要求在jsx最外层的标签上,加一个key属性,值不能和其他的标签的key重复(在父元素的范围内不重复即可)
            <li key={index}>{item}</li>
          ))}
        </ul>
      )
      ReactDOM.render(ul, document.getElementById('root'))
    </script>
  </body>
</html>
